pub fn convert_base(num_str: &str, base_to: u32) -> String {
    let parts: Vec<&str> = num_str.split('(').collect();
    if parts.len() != 2 {
        panic!("Invalid input format");
    }
    let num_str = parts[0];
    let base_from: u32 = parts[1].trim_end_matches(')').parse().expect("Invalid base");
    let mut decimal_value = 0u64;  // 保证所有运算结果为 u64
    for (i, c) in num_str.chars().rev().enumerate() {
        let digit_value = match c {
            '0'..='9' => c.to_digit(10).unwrap() as u64,  // 将数字字符转换为 u64
            'a'..='f' => c.to_digit(16).unwrap() as u64,  // 将字母字符转换为 u64
            'A'..='F' => c.to_digit(16).unwrap() as u64,  // 支持大写字母
            _ => panic!("Invalid character in the number"),
        };

        if digit_value >= base_from as u64 {  // 将 base_from 转换为 u64
            panic!("Invalid digit for the given base");
        }

        decimal_value += digit_value * (base_from as u64).pow(i as u32);  // 将 base_from 转换为 u64
    }

    // 2. 将十进制值转换为目标进制
    if decimal_value == 0 {
        return "0".to_string();
    }

    let mut result = String::new();
    let mut value = decimal_value;

    while value > 0 {
        let remainder = value % (base_to as u64);  // 将 base_to 转换为 u64
        let digit = if remainder < 10 {
            (b'0' + remainder as u8) as char
        } else {
            (b'a' + (remainder - 10) as u8) as char
        };
        result.push(digit);
        value /= base_to as u64;  // 将 base_to 转换为 u64
    }

    result.chars().rev().collect() // 结果需要反转，因为我们是从最低位开始的
}
